#!/usr/bin/env python

import datetime
import time
from crontab import CronTab
from datetime import datetime

class jobs:
    def __init__(self,n,t,c):
        self.name = n
        self.tm = CronTab(t)
        self.cmd = c
    def dos(self):
        return [self.name,self.tm.next(),self.cmd]
    def js(self):
        return self.tm.next()

def rf():
    f = open("cron.txt")
    ls = [] 
    ln = []
    la = []
    try:
        for line in f:
            dr = eval(line.strip())
            ls.append(dr)
            ln.append('')
        for i in range(len(ls)):
            ln[i] = (jobs(ls[i]['JOB'],ls[i]['TM'],ls[i]['CMD']))
#            print ln[i].js() 
            la.append(ln[i].dos())
    finally:
        f.close()
        return la

if __name__ =="__main__":
    print rf()
